home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / network / ka9q / nhclb120.zoo / telnet.h < prev    next >
C/C++ Source or Header  |  1992-05-27  |  2KB  |  68 lines

  1. #define    LINESIZE    256    /* Length of local editing buffer */
  2.  
  3.  
  4. /* Telnet command characters */
  5. #define    IAC        255    /* Interpret as command */
  6. #define    WILL        251
  7. #define    WONT        252
  8. #define    DO        253
  9. #define    DONT        254
  10. #define    TN_DM        242        /* data mark--for connect. cleaning */
  11. #define    SB        250        /* interpret as subnegotiation */
  12. #define    SE        240        /* end sub negotiation */
  13.  
  14.  
  15. /* Telnet options */
  16. #define    TN_TRANSMIT_BINARY    0
  17. #define    TN_ECHO            1
  18. #define    TN_SUPPRESS_GA        3
  19. #define    TN_STATUS        5
  20. #define    TN_TIMING_MARK        6
  21. #define    TN_TTYPE        24
  22. #define TN_LFLOW        33
  23. #define    NOPTIONS        34
  24.  
  25. /* Telnet protocol control block */
  26. struct telnet {
  27.     struct tcb *tcb;
  28.     char state;
  29.  
  30. #define    TS_DATA    0    /* Normal data state */
  31. #define    TS_IAC    1    /* Received IAC */
  32. #define    TS_WILL    2    /* Received IAC-WILL */
  33. #define    TS_WONT    3    /* Received IAC-WONT */
  34. #define    TS_DO    4    /* Received IAC-DO */
  35. #define    TS_DONT    5    /* Received IAC-DONT */
  36. #define    TS_SB    7        /* sub-option collection */
  37. #define    TS_SE    8        /* looking for sub-option end */
  38.  
  39. #define SUBBUFSIZE 64
  40.  
  41. #define    SB_CLEAR()    tn->subpointer = tn->subbuffer;
  42. #define    SB_TERM()    { tn->subend = tn->subpointer; SB_CLEAR(); }
  43. #define    SB_ACCUM(c)    if (tn->subpointer < (tn->subbuffer+SUBBUFSIZE)) { \
  44.                 *(tn->subpointer)++ = (c); \
  45.             }
  46. #define    SB_GET()    ((*(tn->subpointer)++)&0xff)
  47. #define    SB_PEEK()    ((*(tn->subpointer))&0xff)
  48. #define    SB_EOF()    (tn->subpointer >= tn->subend)
  49. #define    SB_LEN()    (tn->subend - tn->subpointer)
  50.  
  51.     char outsup;        /* nonzero if output suppressed */
  52.     char lflow;        /* 1 if flow control on */
  53.     char local[NOPTIONS];    /* Local option settings */
  54.     char remote[NOPTIONS];    /* Remote option settings */
  55.     /* buffer for sub-options */
  56.     unsigned char    subbuffer[SUBBUFSIZE], *subpointer, *subend;
  57. #ifdef    UNIX
  58.     struct    mbuf    *inbuf;        /* ptr to buffer holding excess rcvd chars */
  59.     struct    mbuf    *outbuf;    /* ptr to buffer holding excess to-send chars */
  60.     int    fd;            /* file descriptor of pty */
  61. #endif
  62.     struct session *session;    /* Pointer to session structure */
  63. };
  64. #define    NULLTN    (struct telnet *)0
  65. extern int refuse_echo;
  66. struct telnet *open_telnet();
  67. int send_tel(),tel_input();
  68.